#include "cameraDrv.h"

camI2cCfg_t sp0A39_2sdrRegInfo[] = 
{
    {0xfd,0x00},
    {0x1d,0x25},
    {0x31,0x04},
    {0x32,0x01},
    {0x30,0x01},
    {0xfd,0x01},
    {0x5d,0x01},
    {0x34,0xe3},
    {0x35,0x10},
    {0xfd,0x00},
    {0xf0,0xff},
    {0xf1,0xff},
    {0xf2,0xff},
    {0xf3,0xff},
    {0xfc,0x50},
    {0xfd,0x00},
    {0x03,0x00},
    {0x04,0xf0},
    {0x24,0x10},
    {0xef,0x40},
    {0x06,0x00},
    {0x09,0x00},
    {0x0a,0x46},
    {0x10,0x07},
    {0x11,0x04},
    {0x16,0x01},
    {0x19,0x22},
    {0x1e,0x58},
    {0x29,0x48},
    {0x13,0x37},
    {0x14,0x01},
    {0x25,0x01},
    {0x2a,0x06},
    {0x27,0x01},
    {0x54,0x00},
    {0x55,0x10},
    {0x58,0x38},
    {0x5d,0x12},
    {0x63,0x00},
    {0x64,0x00},
    {0x66,0x28},
    {0x68,0x2a},
    {0x72,0x3a},
    {0x73,0x0a},
    {0x75,0x48},
    {0x76,0x0a},
    {0x1f,0x77},
    {0x20,0x07},
    {0xfb,0x16},
    {0xfd,0x01},
    {0xf2,0x69},
    {0xf7,0x28},
    {0x02,0x10},
    {0x03,0x01},
    {0x06,0x28},
    {0x08,0x01},
    {0xfd,0x02},
    {0xb8,0x50},
    {0xb9,0xff},
    {0xba,0x40},
    {0xbb,0x45},
    {0xbc,0xc0},
    {0xbd,0x50},
    {0xbe,0x80},
    {0xbf,0x02},
    {0xd0,0x80},
    {0xd1,0x02},
    {0xfd,0x01},
    {0xc0,0x1f},
    {0xc1,0x18},
    {0xc2,0x15},
    {0xc3,0x13},
    {0xc4,0x13},
    {0xc5,0x12},
    {0xc6,0x12},
    {0xc7,0x11},
    {0xc8,0x11},
    {0xc9,0x11},
    {0xca,0x10},
    {0xf3,0x10},
    {0xf4,0x10},
    {0xfd,0x01},
    {0x04,0xff},
    {0x05,0x10},
    {0x0a,0x30},
    {0x0b,0x10},
    {0xfd,0x01},
    {0xcb,0x38},
    {0xcc,0x35},
    {0xcd,0x03},
    {0xce,0x05},
    {0xfd,0x00},
    {0xfb,0x16},
    {0x35,0xaa},
    {0xfd,0x01},
    {0x1e,0x00},
    {0x20,0x00},
    {0x84,0x25},
    {0x85,0x25},
    {0x86,0x1f},
    {0x87,0x23},
    {0x88,0x1c},
    {0x89,0x20},
    {0x8a,0x1a},
    {0x8b,0x15},
    {0x8c,0x15},
    {0x8d,0x1a},
    {0x8e,0x0a},
    {0x8f,0x13},
    {0x90,0x13},
    {0x91,0x00},
    {0x92,0x0a},
    {0x93,0x08},
    {0x94,0x12},
    {0x95,0x00},
    {0x96,0x0a},
    {0x97,0x08},
    {0x98,0x15},
    {0x99,0x00},
    {0x9a,0x0a},
    {0x9b,0x05},
    {0xe8,0x20},
    {0xe9,0x0f},
    {0xea,0x00},
    {0xfd,0x01},
    {0xa4,0x00},
    {0x0e,0x80},
    {0x18,0x80},
    {0x0f,0x20},
    {0x10,0x90},
    {0x11,0x80},
    {0x12,0x80},
    {0x13,0xa0},
    {0x14,0x80},
    {0x15,0x90},
    {0x16,0x85},
    {0x17,0x85},
    {0x6e,0x00},
    {0x6f,0x03},
    {0x70,0x07},
    {0x71,0x0d},
    {0x72,0x17},
    {0x73,0x29},
    {0x74,0x3d},
    {0x75,0x4f},
    {0x76,0x5f},
    {0x77,0x79},
    {0x78,0x8c},
    {0x79,0x9d},
    {0x7a,0xa9},
    {0x7b,0xb3},
    {0x7c,0xbe},
    {0x7d,0xc7},
    {0x7e,0xd0},
    {0x7f,0xd6},
    {0x80,0xde},
    {0x81,0xe4},
    {0x82,0xe9},
    {0x83,0xee},
    {0xfd,0x02},
    {0x09,0x06},
    {0x0d,0x1a},
    {0x1c,0x09},
    {0x1d,0x03},
    {0x1e,0x10},
    {0x1f,0x06},
    {0xfd,0x01},
    {0x32,0x00},
    {0xfd,0x02},
    {0x26,0xcb},
    {0x27,0xc2},
    {0x10,0x00},
    {0x11,0x00},
    {0x18,0x17},
    {0x19,0x36},
    {0x2a,0x01},
    {0x2b,0x10},
    {0x28,0xf8},
    {0x29,0x08},
    {0x66,0x5F},
    {0x67,0x7f},
    {0x68,0xE0},
    {0x69,0x10},
    {0x69,0x10},
    {0x6a,0xa6},
    {0x7c,0x4A},
    {0x7d,0x80},
    {0x7e,0x00},
    {0x7f,0x30},
    {0x80,0xaa},
    {0x70,0x32},
    {0x71,0x60},
    {0x72,0x30},
    {0x73,0x5a},
    {0x74,0xaa},
    {0x6b,0xff},
    {0x6c,0x50},
    {0x6d,0x40},
    {0x6e,0x60},
    {0x6f,0x6a},
    {0x61,0xff},
    {0x62,0x27},
    {0x63,0x51},
    {0x64,0x7f},
    {0x65,0x6a},
    {0x75,0x80},
    {0x76,0x09},
    {0x77,0x02},
    {0x0e,0x12},
    {0x3b,0x09},
    {0x48,0xea},
    {0x49,0xfc},
    {0x4a,0x05},
    {0x02,0x00},
    {0x03,0x88},
    {0xf5,0xfe},
    {0x22,0xfe},
    {0x20,0xfe},
    {0xf7,0xfe},
    {0xfd,0x02},
    {0xde,0x0f},
    {0xcf,0x0a},
    {0xd7,0x0a},
    {0xd8,0x12},
    {0xd9,0x14},
    {0xda,0x1a},
    {0xdc,0x07},
    {0xe8,0x60},
    {0xe9,0x40},
    {0xea,0x40},
    {0xeb,0x30},
    {0xec,0x60},
    {0xed,0x50},
    {0xee,0x40},
    {0xef,0x30},
    {0xd3,0x30},                                
    {0xd4,0xc0},
    {0xd5,0x50},
    {0xd6,0x0b},
    {0xf0,0x7f},
    {0xfd,0x01},
    {0xb1,0xf0},
    {0xfd,0x02},
    {0xdc,0x07},
    {0x05,0x08},
    {0xfd,0x01},
    {0x26,0x33},
    {0x27,0x99},
    {0x62,0xf0},
    {0x63,0x80},
    {0x64,0x80},
    {0x65,0x20},
    {0xfd,0x02},
    {0xdd,0xff},
    {0xfd,0x01},
    {0xa8,0x00},
    {0xa9,0x09},
    {0xaa,0x09},
    {0xab,0x0c},
    {0xd3,0x00},
    {0xd4,0x09},
    {0xd5,0x09},
    {0xd6,0x0c},
    {0xcf,0xff},
    {0xd0,0xf0},
    {0xd1,0x80},
    {0xd2,0x80},
    {0xdf,0xff},
    {0xe0,0xf0},
    {0xe1,0xd0},
    {0xe2,0x80},
    {0xe3,0xff},
    {0xe4,0xf0},
    {0xe5,0xd0},
    {0xe6,0x80},
    {0xfd,0x02},
    {0x15,0xe0},
    {0x16,0x95},
    {0xa0,0x9b},
    {0xa1,0xe4},
    {0xa2,0x01},
    {0xa3,0xf2},
    {0xa4,0x8f},
    {0xa5,0xff},
    {0xa6,0x01},
    {0xa7,0xdb},
    {0xa8,0xa4},
    {0xac,0x80},
    {0xad,0x21},
    {0xae,0xdf},
    {0xaf,0xf2},
    {0xb0,0xa0},
    {0xb1,0xee},
    {0xb2,0xea},
    {0xb3,0xd9},
    {0xb4,0xbd},
    {0xfd,0x01},
    {0xb3,0xb0},
    {0xb4,0x90},
    {0xb5,0x70},
    {0xb6,0x55},
    {0xb7,0xb0},
    {0xb8,0x90},
    {0xb9,0x70},
    {0xba,0x55},
    {0xfd,0x01},
    {0xbf,0xff},
    {0x00,0x00},
    {0xfd,0x01},
    {0xa4,0x00},
    {0xa5,0x1f},
    {0xa6,0x50},
    {0xa7,0x65},
    {0xfd,0x02},
    {0x30,0x38},
    {0x31,0x40},
    {0x32,0x40},
    {0x33,0xd0},
    {0x34,0x10},
    {0x35,0x60},
    {0x36,0x28},
    {0x37,0x07},
    {0x38,0x08},
    {0xe6,0x8F},
    {0xfd,0x01},
    {0x1b,0x15},
    {0x1c,0x1A},
    {0x1d,0x0c},
    {0xfd,0x01},
    {0x32,0x15},
    {0x33,0xef},
    {0x36,0x10},
    {0xf6,0xb0},
    {0xf5,0x10},
    {0xd7,0x3a},
    {0xd8,0x10},
    {0xd9,0x20},
    {0xda,0x10},
    {0xdb,0x7a},
    {0xdc,0x3a},
    {0xdd,0x30},
    {0xde,0x30},
    {0xe7,0x3a},
    {0x9c,0xaa},
    {0x9d,0xaa},
    {0x9e,0x55},
    {0x9f,0x55},
    {0xfd,0x00},
    {0x1c,0x00},
    {0xfd,0x00},
    
    {0xfd,0x00},
    {0x30,0x0b},
    {0x1c,0xdc},
    {0x2c,0x1d}, // LSB
    {0x2e,0xe1},
    

};

camI2cCfg_t sp0A39_1sdrRegInfo[] = 
{
	{0xfd,0x00},
	{0x1d,0x25},
	{0x31,0x04},
	{0x32,0x01},
	{0x30,0x01},
	{0xfd,0x01},
	{0x5d,0x01},
	{0x34,0xe3},
	{0x35,0x10},
	{0xfd,0x00},
	{0xf0,0xff},
	{0xf1,0xff},
	{0xf2,0xff},
	{0xf3,0xff},
	{0xfc,0x50},
	{0xfd,0x00},
	{0x03,0x03},
	{0x04,0x6c},
	{0x24,0x10},
	{0xef,0x40},
	{0x06,0x00},
	{0x09,0x00},
	{0x0a,0x80},
	{0x10,0x07},
	{0x11,0x04},
	{0x16,0x01},
	{0x19,0x22},
	{0x1e,0x58},
	{0x29,0x48},
	{0x13,0x37},
	{0x14,0x01},
	{0x25,0x01},
	{0x2a,0x06},
	{0x27,0x01},
	{0x54,0x00},
	{0x55,0x10},
	{0x58,0x38},
	{0x5d,0x12},
	{0x63,0x00},
	{0x64,0x00},
	{0x66,0x28},
	{0x68,0x2a},
	{0x72,0x3a},
	{0x73,0x0a},
	{0x75,0x48},
	{0x76,0x0a},
	{0x1f,0x77},
	{0x20,0x07},
	{0xfb,0x16},
	{0xfd,0x01},
	{0xf2,0x69},
	{0xf7,0x97},
	{0x02,0x08},
	{0x03,0x01},
	{0x06,0x8a},
	{0x08,0x01},
	{0xfd,0x02},
	{0xb8,0x50},
	{0xb9,0xff},
	{0xba,0x40},
	{0xbb,0x45},
	{0xbc,0xc0},
	{0xbd,0x50},
	{0xbe,0xb8},
	{0xbf,0x04},
	{0xd0,0xb8},
	{0xd1,0x04},
	{0xfd,0x01},
	{0xc0,0x1f},
	{0xc1,0x18},
	{0xc2,0x15},
	{0xc3,0x13},
	{0xc4,0x13},
	{0xc5,0x12},
	{0xc6,0x12},
	{0xc7,0x11},
	{0xc8,0x11},
	{0xc9,0x11},
	{0xca,0x10},
	{0xf3,0x10},
	{0xf4,0x10},
	{0xfd,0x01},
	{0x04,0xff},
	{0x05,0x10},
	{0x0a,0x30},
	{0x0b,0x10},
	{0xfd,0x01},
	{0xcb,0x38},
	{0xcc,0x35},
	{0xcd,0x03},
	{0xce,0x05},
	{0xfd,0x00},
	{0xfb,0x16},
	{0x35,0xaa},
	{0xfd,0x01},
	{0x1e,0x00},
	{0x20,0x00},
	{0x84,0x25},
	{0x85,0x25},
	{0x86,0x1f},
	{0x87,0x23},
	{0x88,0x1c},
	{0x89,0x20},
	{0x8a,0x1a},
	{0x8b,0x15},
	{0x8c,0x15},
	{0x8d,0x1a},
	{0x8e,0x0a},
	{0x8f,0x13},
	{0x90,0x13},
	{0x91,0x00},
	{0x92,0x0a},
	{0x93,0x08},
	{0x94,0x12},
	{0x95,0x00},
	{0x96,0x0a},
	{0x97,0x08},
	{0x98,0x15},
	{0x99,0x00},
	{0x9a,0x0a},
	{0x9b,0x05},
	{0xe8,0x20},
	{0xe9,0x0f},
	{0xea,0x00},
	{0xfd,0x01},
	{0xa4,0x00},
	{0x0e,0x80},
	{0x18,0x80},
	{0x0f,0x20},
	{0x10,0x90},
	{0x11,0x80},
	{0x12,0x80},
	{0x13,0xa0},
	{0x14,0x80},
	{0x15,0x90},
	{0x16,0x85},
	{0x17,0x85},
	{0x6e,0x00},
	{0x6f,0x03},
	{0x70,0x07},
	{0x71,0x0d},
	{0x72,0x17},
	{0x73,0x29},
	{0x74,0x3d},
	{0x75,0x4f},
	{0x76,0x5f},
	{0x77,0x79},
	{0x78,0x8c},
	{0x79,0x9d},
	{0x7a,0xa9},
	{0x7b,0xb3},
	{0x7c,0xbe},
	{0x7d,0xc7},
	{0x7e,0xd0},
	{0x7f,0xd6},
	{0x80,0xde},
	{0x81,0xe4},
	{0x82,0xe9},
	{0x83,0xee},
	{0xfd,0x02},
	{0x09,0x06},
	{0x0d,0x1a},
	{0x1c,0x09},
	{0x1d,0x03},
	{0x1e,0x10},
	{0x1f,0x06},
	{0xfd,0x01},
	{0x32,0x00},
	{0xfd,0x02},
	{0x26,0xcb},
	{0x27,0xc2},
	{0x10,0x00},
	{0x11,0x00},
	{0x18,0x17},
	{0x19,0x36},
	{0x2a,0x01},
	{0x2b,0x10},
	{0x28,0xf8},
	{0x29,0x08},
	{0x66,0x5F},
	{0x67,0x7f},
	{0x68,0xE0},
	{0x69,0x10},
	{0x69,0x10},
	{0x6a,0xa6},
	{0x7c,0x4A},
	{0x7d,0x80},
	{0x7e,0x00},
	{0x7f,0x30},
	{0x80,0xaa},
	{0x70,0x32},
	{0x71,0x60},
	{0x72,0x30},
	{0x73,0x5a},
	{0x74,0xaa},
	{0x6b,0xff},
	{0x6c,0x50},
	{0x6d,0x40},
	{0x6e,0x60},
	{0x6f,0x6a},
	{0x61,0xff},
	{0x62,0x27},
	{0x63,0x51},
	{0x64,0x7f},
	{0x65,0x6a},
	{0x75,0x80},
	{0x76,0x09},
	{0x77,0x02},
	{0x0e,0x12},
	{0x3b,0x09},
	{0x48,0xea},
	{0x49,0xfc},
	{0x4a,0x05},
	{0x02,0x00},
	{0x03,0x88},
	{0xf5,0xfe},
	{0x22,0xfe},
	{0x20,0xfe},
	{0xf7,0xfe},
	{0xfd,0x02},
	{0xde,0x0f},
	{0xcf,0x0a},
	{0xd7,0x0a},
	{0xd8,0x12},
	{0xd9,0x14},
	{0xda,0x1a},
	{0xdc,0x07},
	{0xe8,0x60},
	{0xe9,0x40},
	{0xea,0x40},
	{0xeb,0x30},
	{0xec,0x60},
	{0xed,0x50},
	{0xee,0x40},
	{0xef,0x30},
	{0xd3,0x30},
	{0xd4,0xc0},
	{0xd5,0x50},
	{0xd6,0x0b},
	{0xf0,0x7f},
	{0xfd,0x01},
	{0xb1,0xf0},
	{0xfd,0x02},
	{0xdc,0x07},
	{0x05,0x08},
	{0xfd,0x01},
	{0x26,0x33},
	{0x27,0x99},
	{0x62,0xf0},
	{0x63,0x80},
	{0x64,0x80},
	{0x65,0x20},
	{0xfd,0x02},
	{0xdd,0xff},
	{0xfd,0x01},
	{0xa8,0x00},
	{0xa9,0x09},
	{0xaa,0x09},
	{0xab,0x0c},
	{0xd3,0x00},
	{0xd4,0x09},
	{0xd5,0x09},
	{0xd6,0x0c},
	{0xcf,0xff},
	{0xd0,0xf0},
	{0xd1,0x80},
	{0xd2,0x80},
	{0xdf,0xff},
	{0xe0,0xf0},
	{0xe1,0xd0},
	{0xe2,0x80},
	{0xe3,0xff},
	{0xe4,0xf0},
	{0xe5,0xd0},
	{0xe6,0x80},
	{0xfd,0x02},
	{0x15,0xe0},
	{0x16,0x95},
	{0xa0,0x9b},
	{0xa1,0xe4},
	{0xa2,0x01},
	{0xa3,0xf2},
	{0xa4,0x8f},
	{0xa5,0xff},
	{0xa6,0x01},
	{0xa7,0xdb},
	{0xa8,0xa4},
	{0xac,0x80},
	{0xad,0x21},
	{0xae,0xdf},
	{0xaf,0xf2},
	{0xb0,0xa0},
	{0xb1,0xee},
	{0xb2,0xea},
	{0xb3,0xd9},
	{0xb4,0xbd},
	{0xfd,0x01},
	{0xb3,0xb0},
	{0xb4,0x90},
	{0xb5,0x70},
	{0xb6,0x55},
	{0xb7,0xb0},
	{0xb8,0x90},
	{0xb9,0x70},
	{0xba,0x55},
	{0xfd,0x01},
	{0xbf,0xff},
	{0x00,0x00},
	{0xfd,0x01},
	{0xa4,0x00},
	{0xa5,0x1f},
	{0xa6,0x50},
	{0xa7,0x65},
	{0xfd,0x02},
	{0x30,0x38},
	{0x31,0x40},
	{0x32,0x40},
	{0x33,0xd0},
	{0x34,0x10},
	{0x35,0x60},
	{0x36,0x28},
	{0x37,0x07},
	{0x38,0x08},
	{0xe6,0x8F},
	{0xfd,0x01},
	{0x1b,0x15},
	{0x1c,0x1A},
	{0x1d,0x0c},
	{0xfd,0x01},
	{0x32,0x15},
	{0x33,0xef},
	{0x36,0x10},
	{0xf6,0xb0},
	{0xf5,0x10},
	{0xd7,0x3a},
	{0xd8,0x10},
	{0xd9,0x20},
	{0xda,0x10},
	{0xdb,0x7a},
	{0xdc,0x3a},
	{0xdd,0x30},
	{0xde,0x30},
	{0xe7,0x3a},
	{0x9c,0xaa},
	{0x9d,0xaa},
	{0x9e,0x55},
	{0x9f,0x55},
	{0xfd,0x00},
	{0x1c,0x00},
	{0xfd,0x00},

	{0xfd,0x00},
	{0x30,0x0c},
	{0x1c,0xde},
	{0x2c,0x1d}, //LSB
	//{0x2c,0x15}, //MSB
	{0x2e,0xf0},

};

uint16_t sp0a39GetRegCnt(char* regName)
{
    if (strcmp(regName, "sp0a39_2sdr") == 0)
    {
        return (sizeof(sp0A39_2sdrRegInfo) / sizeof(sp0A39_2sdrRegInfo[0]));
    }
    else if (strcmp(regName, "sp0a39_1sdr") == 0)
    {
        return (sizeof(sp0A39_1sdrRegInfo) / sizeof(sp0A39_1sdrRegInfo[0]));
    }
    
    return 0;
}

